<?php
define('IN_YCTOOL', true);//定义该文件合法性
require_once('config.php');
require_once('config2.php');

require_once(DIR_COMM . 'common.php');
if($_GET['action'] == 'ajax')
{   $cip = func::remoteAddr();
    if($_GET['type'] == 'tj')
    {
        
    if(db::insert('tao_scomm',array('sid'=>$_GET['sid'], 'uid'=>$_SESSION['user_uid'],'nick'=>$_SESSION['user_name'],'tjcountflag'=>'1','ctype'=>'2','cip'=>$cip)))
    {
        echo 1;
    }    
    }
    if($_GET['type'] == 'jb')
    {
        if(db::insert('tao_scomm',array('sid'=>$_GET['sid'], 'uid'=>$_SESSION['user_uid'],'nick'=>$_SESSION['user_name'],'jbcountflag'=>'1','ctype'=>'3','cip'=>$cip)))
    {
        echo 1;
    } 
    }
}
if($_POST['action'] == 'commend')
{
    
    $cip = func::remoteAddr();
    db::insert('tao_scomm',array('sid'=>$_POST['sid'], 'uid'=>$_SESSION['user_uid'],'nick'=>$_SESSION['user_name'],'content'=>htmlspecialchars($_POST['content']),'score'=>$_POST['score'],'ctype'=>'1','cip'=>$cip));
    
    func::obHeader($_SERVER['HTTP_REFERER']);
}
if($_GET['sid'])
{
    $thePage = isset($_GET['cpage']) ? $_GET['cpage'] : 1;
    $per = 1;
    $theurlp ="./index.php?go=shop&sid=$sid&cpage=$thePage";
    $rslist = db::getLimit('tao_scomm','*','sid='.$sid.' ORDER BY ctime DESC',$thePage, $per); 
    $count = db::getCount('tao_scomm', '*', 'sid='.$sid );
    !$count && $count=0;
    $rslist = func::htmlspecialcharsArray($rslist);
    if(!$rslist)
    {
        $rslist = array();
    }
    !$count?$count=0:$count=$count;
    $pagestr = func::pageStr($count, $thePage, $per, $theurlp);
}
?>
<script>
 
    function getFocus(th)
    {
        if(th.value == th.title)
        {
            th.value='';
        }
    }
</script>
 
    <div id="fshop_left"><div class="end_pinghui"><div class="end_pingtlt"><div class="end_pbtn_On" id="usercom">                            用户评论<span class="normal_font">(<span id="comment_num" class="orange"><?php echo $count;?></span>)</span></div></div></div><div id="disComment"> 
            <?php foreach($rslist as $key=>$val){?>
            <div class="fyhpl"><div class="fyhname"><?php echo $val ['nick'];?></div>
            <div class="fyhshand"><img src="../i/5-14_pic3.gif"></div><div class="fyhgood"><?php   if($val['score']>3){echo "好评";}else{ echo '差评';}?></div><div class="ftime"><?php echo $val['ctime'];?></div>
                <div class="fyhtall"><?php echo $val['content'];?></div></div>
                <?php } 
                if(!$rslist){
                echo '<div class="fyhpl">暂无评论</div>';
                }
?>
                </div><div class="cardlist03"><div class="quotes"><?php echo $pagestr;?></div></div>
<div id="login" class="comment_login t666 mt10 ml10"><b class="f14 t333 mr10">我要评论...</b>
 
<?php if(!$_SESSION['user_uid']){?>
<a class="blue" target="_blank" href="http://sso.p.cn/cuo/login?service=<?php 
echo urlencode('http://'.$_SERVER['SERVER_NAME'].'/login.php');?>">[登录]</a> &nbsp;&nbsp;
                        <a class="blue" target="_blank" href="http://p.cn/Reg.aspx">[免费注册]</a> 
                            <?php } ?></div>
 
 <form id="comment_form" action="shop_commend.php" target="" method="post"><div id="comment_post"><div class="lh24 f14 t666 pt10 c mt10">  您对店铺的评分：
 </div>
<div id="demo10" style="margin-left: 120px; margin-top: -35px;"><ul style="background-image: url(./i/rater-star.gif); height: 25px; width: 125px;" class="rater-star"><li style="cursor:pointer;background-image: url(./i/rater-star.gif); height: 25px; width: 125px; z-index: 6; display: list-item;" class="rater-star-item-current"></li>
<li style="height: 25px; width: 25px; z-index: 5; background-image: url(./i/rater-star.gif);" name="1" class="rater-star-item"></li><li style="height: 25px; width: 50px; z-index: 4; background-image: url(./i/rater-star.gif);" name="2" class="rater-star-item"></li>
<li style="height: 25px; width: 75px; z-index: 3; background-image: url(./i/rater-star.gif.);" name="3" class="rater-star-item"></li>
<li style="height: 25px; width: 100px; z-index: 2; background-image: url(./i/rater-star.gif);" name="4" class="rater-star-item"></li>
<li style="height: 25px; width: 125px; z-index: 1; background-image: url(/i/rater-star.gif);" name="5" class="rater-star-item"></li></ul></div>
<div style="width:600px;margin-left:280px;">评分：<span id="id_rate">5</span></div><input type="hidden" name="score" value="5" />
<textarea onclick="getFocus(this)" class="textarea-content t999" name="content" title="输入您对此店铺的评价，最多可以输入200个文字">输入您对此店铺的评价，最多可以输入200个文字</textarea>
<br><input type="submit" value="发表评论" id="contentsubmit"><input type="hidden" name="sid" value="<?php echo $sid;?>"><input type="hidden" name="action" value="commend"></div></form> </div>
<div id="fshop_right"> <div class="all">
